package com.ayu.scalalearn.chapter07

import scala.collection.mutable

/**
  * @Author 徐林玉
  * @Description Test08MutableMap
  * @Date 2022/8/4 9:33
  * @Version 1.0
  */
object Test08MutableMap {

  def main(args: Array[String]): Unit = {

    //1、创建map
    val map1: mutable.Map[String, Int] = mutable.Map("a" -> 11, "b" -> 12, "c" -> 13)

    println(map1)
    println(map1.getClass)

    println("============================")

    //2、添加元素
    map1.put("d", 14)
    map1.put("e", 15)

    println(map1)

    map1 += (("f", 16))

    println(map1)

    println("==============================")


    //3、删除元素
    println(map1("c"))
    map1.remove("c")

    println(map1.get("c"))
  }

}
